package com.zgm.ch04._2_2_3;

import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.util.Assert;

public class ShutdownHook implements Runnable {
	private ConfigurableListableBeanFactory beanFactory;
	
	public ShutdownHook(ConfigurableListableBeanFactory beanFactory){
		Assert.notNull(beanFactory, "属性beanFactory不能为空！");
		
		this.beanFactory = beanFactory;
	}
	
	public void run(){
		beanFactory.destroySingletons();
	}
}
